######################################################################
#MarineChar.py
#
#Purpose:  Implements the CharCreation.py module to create and save a Marine 
#   character; mostly for game testing but can be modified for game play
#Author:  Cody Jackson
#Date:  7/3/06
#
#Copyright 2006 Cody Jackson
#This program is free software; you can redistribute it and/or modify it 
#under the terms of the GNU General Public License as published by the Free 
#Software Foundation; either version 2 of the License, or (at your option) 
#any later version.
#
#This program is distributed in the hope that it will be useful, but 
#WITHOUT ANY WARRANTY; without even the implied warranty of 
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
#General Public License for more details.
#
#You should have received a copy of the GNU General Public License 
#along with this program; if not, write to the Free Software Foundation, 
#Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#----------------------------------------------------------------------
#Version 0.1
#   Initial build
######################################################################

#!/usr/bin/env python
import cPickle
import os
from CharCreation import Marine

marine = Marine()

def setCharacter():
    """Create a marine class character."""
    
    marine.setName() 
    marine.setGender()
    marine.setAge()
    marine.setEquipment("Rucksack")     #Test value
    marine.setEquipment("Knife")        #Test value
    marine.setEquipment("Flashlight")   #Test value
    marine.setRank()
    marine.requirements()
    marine.eligibleMOS()
    marine.mosSkills(marine.mosChoice)
    marine.setInitiative()
    marine.setSkills()
 
def saveFile():
    """Create a file location and get a file name for character.
    
    .cmc is the file extension for CMRPG character files."""
    
    saveName = raw_input("Enter a save name for this character's file: ")
    saveName = saveName + ".cmc"
    #---Create a directory and file structure to save the character
#TODO: Make path cross-platform and user-created
    if os.path.isdir("C:\\Marines"):
        pass
    else: os.mkdir("C:\\Marines")
    location = os.path.join("C:\\", "Marines", saveName)
    charSave = open(location, "w")
    cPickle.dump(marine, charSave)
    charSave.close()
    
def test():
    setCharacter()
    saveFile()
    
if __name__ == "__main__":
    test()